<template>
  <div class="registeradd">
    <div class="main">
      <p class="title">预约挂号普通排班{{littleTitle}}</p>
      <Row class="box">
        <Col class="padding-l padding-b" :xs="24">
          <div >
          <Button type="primary" v-if="addBtnFlag && status == 1" @click="getdoctor(1)" >
            <i class = "iconfont icon-add" style="font-size:14px;margin-right:5px"></i>添加医生
          </Button>
          <Button type="primary" v-if="addBtnFlag && status == 2" @click='loadDeptPage(1)'>
            <i class = "iconfont icon-add" style="font-size:14px;margin-right:5px"></i>添加科室
          </Button>
        </div>
        </Col>
      </Row>
      <Row class="box padding-t">
        <Col :xs="24" :md="3" v-if="status == 1">
          <b>{{hospitalName}}</b>
        </Col>
        <Col :xs="24" :md="3" v-if="status == 1">
          <b>{{deptName}}</b>
        </Col>
        <Col :xs="24" :md="2" v-if="status == 1">
          <b>{{doctorName}}</b>
        </Col>

        <Col :xs="24" :md="3" v-if='status == 2'>{{hospitalName}}</Col>
        <Col :xs="24" :md="3" v-if='status == 2'>{{deptName}}</Col>
      </Row>
      <br />
      <Row class="bordered">
        <Col class="text-align-c borderRight" :xs="24" :md="3">
          <b>就诊地址</b>
        </Col>
        <Col class="padding-l" :xs="24" :md="21">
          <Input
            class="w-input"
            @on-change="checkInput"
            :maxlength="60"
            v-model="address"
            placeholder="请输入就诊地址"
          />
          <span class="rdColor" v-if="addressFlag">就诊地址不能为空</span>
        </Col>
      </Row>
      <Row class="bordered">
        <Col class="text-align-c borderRight" :xs="24" :md="3">
          <b>门诊类型</b>
        </Col>
        <Col class="padding-l" :xs="24" :md="21">
          <Select class="w-select" v-model="outpatientType">
            <Option
              v-for="(item,index) of typeList"
              :key="item.id"
              :value="item.name"
              style="text-align:center;"
            >{{item.name}}</Option>
          </Select>
          <Button type="primary" @click="jump">分时段设置</Button>
        </Col>
      </Row>
      <Row class="bordered">
        <Col class="text-align-c" :xs="24" :md="3">
          <b>门诊时间</b>
        </Col>
        <Col class="padding-l borderLeft" :xs="24" :md="21">
          <Row>
            <Col :xs="2">&nbsp;</Col>
            <Col :xs="3">&nbsp;</Col>
            <Col :xs="2">星期一</Col>
            <Col :xs="2">星期二</Col>
            <Col :xs="2">星期三</Col>
            <Col :xs="2">星期四</Col>
            <Col :xs="2">星期五</Col>
            <Col :xs="2">星期六</Col>
            <Col :xs="2">星期日</Col>
          </Row>
          <Row>
            <Col :xs="2">上午</Col>
            <Col :xs="3">
              <TimePicker
                :open="false"
                :value="upTime"
                format="HH:mm"
                type="timerange"
                :editable="false"
                :disabled="true"
              >
                <a href="javascript:void(0)">
                  <Icon type="ios-clock-outline"></Icon>
                  <template>{{ upTime[0] + '-' + upTime[1] }}</template>
                </a>
              </TimePicker>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd11"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd21"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd31"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd41"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd51"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd61"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd71"></InputNumber>
            </Col>
          </Row>
          <Row>
            <Col :xs="2">下午</Col>
            <Col :xs="3">
              <TimePicker
                :open="false"
                :value="dnTime"
                format="HH:mm"
                type="timerange"
                :editable="false"
                :disabled="true"
              >
                <a href="javascript:void(0)">
                  <Icon type="ios-clock-outline"></Icon>
                  <template>{{ dnTime[0] + '-' + dnTime[1] }}</template>
                </a>
              </TimePicker>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd12"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd22"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd32"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd42"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd52"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd62"></InputNumber>
            </Col>
            <Col :xs="2">
              <InputNumber min="1" max="99" v-model="wd72"></InputNumber>
            </Col>
          </Row>
        </Col>
      </Row>
      <Row class="bordered">
        <Col class="text-align-c borderRight" :xs="24" :md="3">
          <b>预约期限</b>
        </Col>
        <Col class="padding-l" :xs="24" :md="21">
          <InputNumber min="1" max="99" @on-change="checkInput" v-model="term"></InputNumber>天
          <span :class="{rdColor:termRd}" class="notice">（备注：建议设置7的倍数。）</span>
        </Col>
      </Row>
      <Row class="bordered">
        <Col class="text-align-c borderRight" :xs="24" :md="3">
          <b>医事服务费</b>
        </Col>
        <Col class="padding-l" :xs="24" :md="21">
          <!-- <InputNumber min="0" max="999" @on-change="checkInput" v-model="fee"></InputNumber>元 -->
          <input min="0" max="999" @on-change="checkInput" v-model="fee" type="number" @input="srInput" class="w-input inputnumber" />元
          <span :class="{rdColor:costRd}" class="notice">（备注：当设置为0时，预约不支付。）</span>
        </Col>
      </Row>
      <Row class="bordered">
        <Col class="text-align-c borderRight" :xs="24" :md="3">
          <b>患者什么时候、到哪里找您领取挂号</b>
        </Col>
        <Col class="padding-l" :xs="24" :md="21">
          <Input
            class="w-area"
            v-model="receive"
            type="textarea"
            :maxlength="100"
            placeholder="请输入挂号领取处"
          />
        </Col>
      </Row>
      <Row class="bordered">
        <Col class="text-align-c borderRight" :xs="24" :md="3">
          <b>备注</b>
        </Col>
        <Col class="padding-l" :xs="24" :md="21">
          <Input class="w-area" v-model="remarks" :maxlength="100" placeholder="请输入备注" />
        </Col>
      </Row>
    </div>   
    <div style="text-align:center;margin: 20px 0">
      <Button type="primary" @click="submit" v-if='status == 1' class="btn">
        <Icon type="ios-checkmark" style="margin-right: 5px" />保存
      </Button>
      <Button type="primary" @click="deptSubmit" v-if='status == 2' class="btn">
        <Icon type="ios-checkmark" style="margin-right: 5px" />保存
      </Button>
      <Button :disabled="btnDisabled" @click="reback">
        <i class = "iconfont icon-butongyi" style="font-size:14px;margin-right:5px"></i> 返回
      </Button>
    </div>
    <!-- 专家列表 -->
    <Modal v-model="docListModal" width="1000" :styles="{top: '20px'}">
      <p slot="header" style="text-align:center">
        <span>选择医生</span>
      </p>
      <div>
        <Row class="bordered">
          <Col :xs="24">
            <fourLevelLinkage
              @changeProvince="changeProvince"
              @changeCity="changeCity"
              @changeArea="changeArea"
              @changeHospital="changeHospital"
              :province="province"
              :city="city"
              :area="area"
              :hospital="hospital"
            ></fourLevelLinkage>
            <Input
              v-model="doctorKey"
              :maxlength="20"
              style='width:200px;'
              placeholder="输入医生姓名、医院"
            />
              <Button type='primary' icon="ios-search" @click='loadPage(1)'></Button>  
          </Col>
        </Row>
        <Row style="margin:15px 0;">
          <Col :xs="24">
            <Table stripe :columns="columns" :data="doctorList" style="width:100%;"></Table>
          </Col>
        </Row>
        <Page :total="count" :current="pageNo" :page-size="pageSize" @on-change="loadPage" style="text-align:center"/>
      </div>
      <div slot="footer"></div>
    </Modal>

    <!-- 科室列表 -->
    <Modal v-model="deptListModal" width="1000" :styles="{top: '20px'}" title='选择科室列表'>
        <div>
            <fourLevelLinkage
                @changeProvince="changeProvince"
                @changeCity="changeCity"
                @changeArea="changeArea"
                @changeHospital="changeHospital"
                :province="province"
                :city="city"
                :area="area"
                :hospital="hospital"
                :isBack="isBack"
            ></fourLevelLinkage>
            <Input
              v-model="deptSearchKey"
              :maxlength="20"
              placeholder="输入科室名称"
              style='width:270px;'
            />
            <Button type='primary' icon="ios-search"  @click='loadDeptPage(1)'></Button>
        </div>
        <Table stripe :columns="deptColumns" :data="deptList" style="width:100%;margin:10px 0;"></Table>
        <Page :total="deptPageCount" :current="deptPageNo" :page-size="deptPageSize" @on-change="loadDeptPage" style='text-align:center' />
    </Modal>
  </div>
</template>
<script>
import api from "@/api/commonApi";
import tempHeader from "@/components/tmpHeader";
import fourLevelLinkage from "@/components/fourLevelLinkage";
import { Avatar } from "view-design";
export default {
  data() {
    return {
        status: "", // 1专家 2科室
        id: null,
        info: null,
        lPageNo: null,
        searchKey: "",
        deptKey: "",
        dictType: "",

        province: null,
        city: null,
        area: null,
        hospital: null,
        isBack: 2,

        littleTitle: "编辑",
        addBtnFlag: false,
        doctorName: null,
        doctorId: null,
        hospitalName: null,
        hospitalId: null,
        title: null,
        deptName: null,
        deptType: null,
        address: null,
        typeList: [
            { id: 1, name: "普通门诊" }
            // {id:2,name:"社保门诊"}
        ],
        outpatientType: "普通门诊",
        upTime: ["08:00", "12:00"],
        dnTime: ["13:00", "17:00"],
        wd11: null,
        wd21: null,
        wd31: null,
        wd41: null,
        wd51: null,
        wd61: null,
        wd71: null,

        wd12: null,
        wd22: null,
        wd32: null,
        wd42: null,
        wd52: null,
        wd62: null,
        wd72: null,

        term: 7,
        fee: 0,
        receive: null,
        remarks: null,
        docListModal: false,
        doctorList: [{ hospitalName: "", deptName: "", doctorName: "", title: "" }],
        doctorKey: "",
        pageNo: 0,
        pageSize: 10,
        count: 0,

        expertMsgStatus: false,
        icut: 1,
        termRd: false,
        costRd: false,

        addressFlag: false,
        // 医生表头信息
        columns: [
            {
                title: "医院名称",
                key: "hospitalName",
                align: "center"
            },
            {
                title: "科室名称",
                key: "deptName",
                align: "center"
            },
            {
                title: "医生名称",
                key: "doctorName",
                align: "center"
            },
            {
                title: "职称",
                key: "title",
                align: "center"
            },
            {
                title: "选择",
                align: "center",
                render: (h, params) => {
                    let item = params.row;
                    return [
                    h(
                        "a",
                        {
                        on: {
                            click: () => {
                            this.chooseDoc(
                                item.hospitalName,
                                item.hospitalId,
                                item.deptName,
                                item.deptType,
                                item.doctorName,
                                item.doctorId,
                                item.title
                            );
                            // this.expert(row)
                            }
                        }
                        },
                        "选择"
                    )
                    ];
                }
            }
        ],
        //   科室列表相关
        deptListModal: false,
        deptPageNo: 1,
        deptPageSize: 10,
        deptPageCount: 10,
        deptList: [],
        deptColumns: [
            {
                title: "医院名称",
                key: "hospitalName",
                align: "center"
            },
            {
                title: "科室名称",
                key: "deptName",
                align: "center"
            },
            {
                title: "选择",
                align: "center",
                render: (h, params) => {
                    let item = params.row;
                    return [
                    h(
                        "a",
                        {
                        on: {
                            click: () => {
                                // console.log('添加科室');
                                this.chooseDept(item)
                            }
                        }
                        },
                        "选择"
                    )
                    ];
                }
            }
        ],
        deptSearchKey:"",
        btnDisabled: false
    };
  },
  watch: {
    doctorId(newId, oldId) {
      if (newId == null || newId == "" || newId == undefined) {
        this.expertMsgStatus = true;
      } else {
        this.expertMsgStatus = false;
      }
    }
  },
  created() {
    let query = this.$route.query;
    this.id = query.id ? query.id : null;
    this.pageNo = query.pageNo ? parseInt(query.pageNo) : 1;
    this.searchKey = query.searchKey ? query.searchKey : "";
    this.deptKey = query.deptKey ? query.deptKey : "";
    this.dictType = query.dictType ? query.dictType : "";
    this.province = query.province ? parseInt(query.province) : null;
    this.city = query.city ? parseInt(query.city) : null;
    this.area = query.area ? parseInt(query.area) : null;
    this.hospital = query.hospital ? query.hospital : null;
    this.hospitalName = query.hospitalName ? query.hospitalName : null;
    this.hospitalId = query.hospitalId ?query.hospitalId : null;
    this.deptName = query.deptName ? query.deptName : null;
    this.deptType = query.deptType ? query.deptType : null;
    this.doctorName = query.doctorName ? query.doctorName : null;
    this.doctorId = query.doctorId ? query.doctorId : null;
    this.title = query.title ? query.title : null;
    this.address = query.address ? query.address : null;
    this.outpatientType = query.outpatientType ? query.outpatientType : "普通门诊";
    this.fee = query.fee ? parseInt(query.fee) : 0;
    this.term = query.term ? parseInt(query.term) : 7;
    this.receive = query.receive ? query.receive : null;
    this.remarks = query.remarks ? query.remarks : null;
    this.docListModal = false;
    this.status = query.status ? query.status : null;

    if (this.id) {
      this.littleTitle = "编辑";
      this.addBtnFlag = false;
    } else {
      this.littleTitle = "新增";
      this.addBtnFlag = true;
      this.expertMsgStatus = true;
    }
    if (this.id) {
        if(this.status == 1) {
            this.loadingDoctorDefalt(this.id)
        } else if(this.status == 2) {
            this.loadingDeptDefalt(this.id)
        }
       
    }

    let breadList = [
      { path: "/index", title: "首页" },
      {
        path: "/index/operation/doctorManagement/index",
        title: "医生运营管理"
      },
      {
        path: "/index/operation/register/list",
        title: "预约挂号排班"
      }
    ];
    this.$emit("changeBreadList", breadList);
  },
  components: { Avatar, tempHeader, fourLevelLinkage },
  methods: {
    // 省市区三级
    changeProvince(val) {
        this.province = val;
    },
    changeCity(val) {
        this.city = val;
    },
    changeArea(val) {
        this.area = val;
    },
    changeHospital(val) {
        this.hospital = val;
    },
    srInput(e) {
      this.fee = e.target.value.match(/^\d*(\.?\d{0,2})/g)[0] || null;
      if(e.target.value>999.99)this.fee=999.99
    },
    Inputwo(e) {
        this.fee = e.target.value.match(/^\d*(\.?\d{0,1})/g)[0] || null;
    },
    // 添加,修改医生排班
    submit(name) {
      let flag = true;
      if (this.fee == null) return (this.costRd = true);
      if (this.term == null) return (this.termRd = true);
      let tmpRegistertimes = [];
      for (let i = 1; i <= 7; i++) {
        for (let j = 1; j <= 2; j++) {
          let tmpObj = {};
          if (j == 1) {
            tmpObj.timeStart = this.upTime[0];
            tmpObj.timeEnd = this.upTime[1];
          } else if (j == 2) {
            tmpObj.timeStart = this.dnTime[0];
            tmpObj.timeEnd = this.dnTime[1];
          }
          if (this["wd" + i + j] != null && this["wd" + i + j] > 0) {
            tmpObj.hyNum = this["wd" + i + j];
            tmpObj.hyDay = j;
            tmpObj.hyWeek = i;
            tmpRegistertimes.push(tmpObj);
          }
        }
      }
      if (!this.address) {
        this.addressFlag = true;
        flag = false;
      }
      if (tmpRegistertimes.length <= 0) {
        flag = false;
        this.$Message.error({
          content: "请至少有一个号源有号再保存，谢谢",
          duration: 5
        });
        return false;
      }
      let params = {};
      params.address = this.address;
      params.fee = this.fee;
      params.deptName = this.deptName;
      params.deptType = this.deptType;
      params.doctorId = this.doctorId;
      params.doctorName = this.doctorName;
      params.hospitalId = this.hospitalId;
      params.hospitalName = this.hospitalName;
      params.isClose = this.isClose;
      params.id = this.id;
      params.outpatientType = this.outpatientType;
      params.receive = this.receive;
      params.remarks = this.remarks;
      params.term = this.term;
      params.registerTimes = tmpRegistertimes;
      params.icut = this.icut;
      params.schedulingType = 1
      params.timeType=1
      let url = "";
      let msg = "";
      if (this.id) {
        url = api.updateAppointment;
        msg = "修改";
      } else {
        url = api.insertAppointment;
        msg = "添加";
      }
      console.log('专家排班', params);
      if (params.doctorId) {
        if (flag) {
          this.btnDisabled = true;
          this.$axios
            .post(url, params)
            .then(resp => {
              if (resp.data.success) {
                this.$Message.info(msg + "成功");
                //   公用方法
                this.reback();
              } else {
                this.btnDisabled = false;
                this.$Message.info(msg + "失败，请重试");
              }
            })
            .catch(err => {
              this.btnDisabled = false;
              console.log(err);
            });
        }
      } else {
        this.expertMsgStatus = true;
        this.$Message.error("请选择医生")
      }
    },
    // 添加,修改科室排班
    deptSubmit () {
        let flag = true;
        if (this.fee == null) return (this.costRd = true);
        if (this.term == null) return (this.termRd = true);
        let tmpRegistertimes = [];
        for (let i = 1; i <= 7; i++) {
            for (let j = 1; j <= 2; j++) {
            let tmpObj = {};
            if (j == 1) {
                tmpObj.timeStart = this.upTime[0];
                tmpObj.timeEnd = this.upTime[1];
            } else if (j == 2) {
                tmpObj.timeStart = this.dnTime[0];
                tmpObj.timeEnd = this.dnTime[1];
            }
            if (this["wd" + i + j] != null && this["wd" + i + j] > 0) {
                tmpObj.hyNum = this["wd" + i + j];
                tmpObj.hyDay = j;
                tmpObj.hyWeek = i;
                tmpRegistertimes.push(tmpObj);
            }
            }
        }
        if (!this.address) {
            this.addressFlag = true;
            flag = false;
        }
        if (tmpRegistertimes.length <= 0) {
            flag = false;
            this.$Message.error({
            content: "请至少有一个号源有号再保存，谢谢",
            duration: 5
            });
        }
        let url = ''
        let msg = ''
        let params = {}
        params.address = this.address;
        params.fee = this.fee;
        params.deptName = this.deptName;
        params.deptType = this.deptType;
        params.hospitalId = this.hospitalId;
        params.hospitalName = this.hospitalName;
        params.outpatientType = this.outpatientType;
        params.receive = this.receive;
        params.remarks = this.remarks;
        params.term = this.term;
        params.registerTimes = tmpRegistertimes;
        params.icut = this.icut;
        params.schedulingType = 2
        params.timeType=1
        console.log('科室排班', params);

        if (this.id) {
            url = api.updateAppointment;
            msg = "修改";
            params.id = this.id;
        } else {
            url = api.insertAppointment;
            msg = "添加";
        }
        if(params.deptType) {
            if (flag) {
              this.btnDisabled = true;
              this.$axios.post(url, params).then(res => {
                  if(res.data.success) {
                      this.$Message.info(msg + "成功");
                      this.reback();
                  } else {
                      this.btnDisabled = false;
                      this.$Message.info(msg + "失败，请重试");
                  }
              })
            }
        } else {
            this.btnDisabled = false;
            this.$Message.error("请选择科室")
        }
        

    },
    // 加载医生排班详情
    loadingDoctorDefalt(id) {
        let url = api.findAppointmentById
        let params = { id: this.id, schedulingType: this.status }
        this.$axios.post(url, params).then(resp => {
            this.info = resp.data.object;
            for (let i = 0; i < this.info.registerTimes.length; i++) {
                let tmpregistertimes = this.info.registerTimes[i];
                this["wd" + tmpregistertimes.hyWeek + tmpregistertimes.hyDay] =
                tmpregistertimes.hyNum;
            }
            this.doctorName = this.info.doctorName;
            this.doctorId = this.info.doctorId;
            this.hospitalName = this.info.hospitalName;
            this.hospitalId = this.info.hospitalId;
            this.deptName = this.info.deptName;
            this.deptType = this.info.deptType;
            this.address = this.info.address;
            this.outpatientType = this.info.outpatientType;
            this.term = this.info.term;
            this.fee = this.info.fee;
            this.receive = this.info.receive;
            this.remarks = this.info.remarks;
            })
            .catch(err => {
            // this.$Message.info("服务器超时，请重新访问");
        });
    },
    // 加载科室排班详情
    loadingDeptDefalt(){
        let url = api.findAppointmentById
        let params = {
            id: this.id,
            schedulingType: this.status,
        }
        console.log(params);
        // return ''
        this.$axios.post(url, params).then(res => {
            if(res.data.success) {
                this.info = res.data.object;
                for (let i = 0; i < this.info.registerTimes.length; i++) {
                    let tmpregistertimes = this.info.registerTimes[i];
                    this["wd" + tmpregistertimes.hyWeek + tmpregistertimes.hyDay] =
                    tmpregistertimes.hyNum;
                }
                this.hospitalName = this.info.hospitalName;
                this.hospitalId = this.info.hospitalId;
                this.deptName = this.info.deptName;
                this.deptType = this.info.deptType;
                this.address = this.info.address;
                this.outpatientType = this.info.outpatientType;
                this.term = this.info.term;
                this.fee = this.info.fee;
                this.receive = this.info.receive;
                this.remarks = this.info.remarks;
                console.log(this.info);
            } else {
                this.$Message.error("加载科室排班详情失败")
            }
        })
    },
    // 公用数据
    checkInput() {
      if (this.term == null) this.termRd = true;
      else this.termRd = false;
      if (this.fee == null) this.costRd = true;
      else this.costRd = false;
      if (!this.address) this.addressFlag = true;
      else this.addressFlag = false;
    },
    // 返回上一页
    reback() {
      let query = this.$route.query
      //   公用方法
      this.functionJS.queryNavgationTo(this, "/index/doctorOperation/register/list", {
        pageNo: this.lPageNo,
        province: query.province,
        city: query.city,
        area: query.area,
        hospital: query.hospital,
        isBack: 2,
        searchKey: this.searchKey,
        deptKey: this.deptKey,
        dictType: this.dictType
      });
    },
    // 保留医生信息
    chooseDoc(
      hospitalName,
      hospitalId,
      deptName,
      deptType,
      doctorName,
      doctorId,
      title
    ) {
      console.log(this.doctorList);
      this.hospitalName = hospitalName;
      this.hospitalId = hospitalId;
      this.deptName = deptName;
      this.deptType = deptType;
      this.doctorName = doctorName;
      this.doctorId = doctorId;
      this.title = title;
      this.docListModal = false;
    },
    // 保留科室信息
    chooseDept(row) {
        this.hospitalName = row.hospitalName;
        this.hospitalId = row.hospitalId;
        this.deptName = row.deptName;
        this.deptType = row.deptType;
        this.deptListModal = false
    },
    // 科室列表分页
    loadDeptPage(pageNo) {
        this.deptPageNo = pageNo
        let url = api.deptScheduling
        let params = {}
        params.searchKey = this.deptSearchKey.trim();
        params.pageNo = pageNo;
        params.pageSize = this.deptPageSize;
        params.provinceCode = this.province ? this.province : null;
        params.cityCode = this.city ? this.city : null;
        params.areaCode = this.area ? this.area : null;
        params.hospitalId = this.hospital ? this.hospital : null;
        this.$axios.post(url, params).then(resp => {
            if (resp.data.success) {
                this.deptList = resp.data.object.list;
                console.log(resp);
                this.deptPageCount = resp.data.object.count;
                this.deptPagepageNo = pageNo;
                this.deptListModal = true;
            } else {
                this.$Message.info("未分配【查询医院没有排班的科室】权限");
            }
        }).catch(err => {
            console.log(err);
        })
    },
    getdoctor(){
      this.docListModal = true;
      this.province = ''
      this.city = ''
      this.area = ''
      this.hospital = ''
      this.loadPage(1)
    },
    // 专家列表分页
    loadPage(pageNo) {
      this.pageNo = pageNo;
      var params = {};
      params.searchKey = this.doctorKey.trim();
      params.pageNo = pageNo;
      params.pageSize = this.pageSize;
      params.provinceCode = this.province ? this.province : null;
      params.cityCode = this.city ? this.city : null;
      params.areaCode = this.area ? this.area : null;
      params.hospitalId = this.hospital ? this.hospital : null;
      this.$axios
        .post(api.doctorNotScheduling, params)
        .then(resp => {
          if (resp.data.success) {
            let ret = resp.data.object
            console.log(ret)
            this.doctorList = resp.data.object.records;
            this.count = resp.data.object.total;
            this.pageNo = pageNo;
            this.docListModal = true;
          } else {
            this.$Message.info("查询失败，请重试");
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    // 跳转到分时段设置
    jump() {
      this.functionJS.queryNavgationTo(
        this,
        "/index/doctorOperation/register/segmentationedit",
        {
          id: this.id,
          pageNo: this.lPageNo,
          province: this.province,
          city: this.city,
          area: this.area,
          hospital: this.hospital,
          isBack: 2,
          searchKey: this.searchKey,
          deptKey: this.deptKey,
          dictType: this.dictType,
          hospitalName: this.hospitalName,
          hospitalId: this.hospitalId,
          deptName: this.deptName,
          deptType: this.deptType,
          doctorName: this.doctorName,
          doctorId: this.doctorId,
          title: this.title,
          address: this.address,
          outpatientType: this.outpatientType,
          fee: this.fee,
          term: this.term,
          receive: this.receive,
          remarks: this.remarks,
          status: this.status,
        }
      );
      console.log(33333333)
    }
  }
};
</script>
<style>
.ivu-date-picker-rel a{
  color: #666 !important;
}
.ivu-date-picker-rel a:hover{
  color: #5362e1 !important;
}
</style>
<style lang="less" scoped>
.registeradd {
  padding: 10px 0;
  width: 100%;
  background: #ffffff;
  box-sizing: border-box;
  .main{
    width: 98%;
    display: flex;
    flex-direction: column;
    margin: 10px auto;
    border: 1px solid #f0f0f0;
    box-shadow: 0 4px 3px #ebedf8;
    border-radius: 5px;
    padding-bottom: 30px;
    .box{
      margin-left: 20px;
    }
    .title {
      font-size: 20px;
      padding-left: 15px;
      margin-bottom: 20px;
      color: #333;
      height: 40px;
      line-height: 40px;
      background: #ebedf8;         
    }
  }
  .btn {
      width: 75px;
      height: 35px;
  }
  .tt {
    font-size: 22px;
    font-weight: 700;
    padding-left: 4px;
    border-left: 2px solid #5362e1;
    position: relative;
    line-height: 32px;
  }
  .padding-t {
    padding-top: 10px;
  }
  .padding-l {
    padding-left: 5px;
  }
  .padding-r {
    padding-right: 5px;
  }
  .padding-b {
    padding-bottom: 5px;
  }
  .borderRight {
    border-right: 1px solid #e5e5e5;
  }
  .borderLeft {
    border-left: 1px solid #e5e5e5;
  }
  .borderBottom {
    border-bottom: 1px solid #e5e5e5;
  }
  .borderTop {
    border-top: 1px solid #e5e5e5;
  }
  .w-select {
    width: 100px;
  }
  .w-input {
    width: 200px;
  }
  .inputnumber {
      width: 10%;
      background: #fff;
      border: none;
      outline: none;
      text-indent: 10px;
      line-height: 30px;
      border: 1px solid #ddd;
      border-radius: 4px;
      color: #666;
  }
  .inputnumber:focus{
    border-color:#5362e1
  }
  .req-icon {
    font-size: 18px;
    color: red;
    display: inline-block;
    height: 18px;
    width: 18px;
    text-align: center;
    line-height: 18px;
    vertical-align: middle;
  }
  .text-align-c {
    text-align: center;
    line-height: 32px;
  }
  .bordered {
    border: 1px solid #e5e5e5;
    margin: 0 20px;
  }
  b {
    font-weight: bold;
  }
  .expert-msg {
    color: #f00;
    display: none;
  }
  .show-msg {
    display: inline-block;
  }
  .w-area {
    width: 80%;
  }
  .notice {
    display: inline-block;
    margin-left: 15px;
    color: #aaa;
  }
  span.rdColor {
    color: #ff0000;
  }
}
</style>